import { globalaction } from "../types/global";

interface initstate {
  message: string;
}

const initvalue: initstate = {
  message: "",
};

export default function global(
  state = initvalue,
  action: globalaction
): initstate {
  const { payload, type } = action;

  switch (type) {
    case "changemessage":
      return { ...state, message: payload };
    default:
      return state;
  }
}
